bash Idioms by Carl Albing & JP Vossen

bash Idioms by Carl Albing & JP Vossen

Author:Carl Albing & JP Vossen [Carl Albing]
Language: eng
Format: epub, pdf
Publisher: O'Reilly Media, Inc.
Published: 2022-04-25T00:00:00+00:00


Watch out for bash version with hashes

You really need to be careful about your bash version here. As we just said, bash didn’t get associative arrays until version 4.0 and it took a couple of versions to sort out some details, like allowing $list[-1] to refer to the last integer element (v4.3), instead of needing mylist[${#mylist[*]}-1]. Ouch.

As we said in earlier content, watch out for stock bash on a Mac, it’s quite old. You’ll find newer versions in MacPorts, Homebrew, or Fink.

Also, arrays (lists and hashes) are not specified by POSIX, so if portability beyond bash is a concern you’ll need to be very careful using them because they might not work.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.